package cn.tedu.supermarket.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CheckPasswordController {
    @RequestMapping(value = "/password", produces = "text/html;charset=utf-8")
    public String checkpassword(String password1, String password2) {
        System.out.println("checkpassword");
        System.out.println(password1+","+password2);
        if (password1==null||"".equals(password1)) {
            System.out.println("请输入密码");
            return "请输入密码";
        }else if (!password1.matches(".{6,20}")){
            System.out.println("密码必须为6~20位");
            return "密码必须为6~20位";
        }else if (password1.equals(password2)){
            System.out.println("密码一致");
            return "";
        } else {
            System.out.println("密码不一致");
            return "密码不一致";
        }
    }

    @RequestMapping(value = "/LoginPassword", produces = "text/html;charset=utf-8")
    public String checkLoginPassword(String password) {
        System.out.println("checkLoginPassword");
        if (password==null||password=="") {
            System.out.println("请输入密码");
            return "请输入密码";
        } else {
            System.out.println("密码为:"+password);
            return "";
        }
    }

}
